package hr.ctg.web.validator;

import java.util.Map;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
import javax.persistence.EntityManager;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

@Name("simpleValidator")
public class SimpleValidator {
	@In
	private Map<String, String> messages;

	@In
	EntityManager entityManager;

	public void validateRequired(final FacesContext facesContext,
			final UIComponent uiComponent, final Object object)
			throws ValidatorException {
		final boolean agree = (Boolean) object;
		if (!agree) {
			throw new ValidatorException(new FacesMessage(messages
					.get("message.agree.false")));
		}
	}
}
